package org.hackystat.ui.telemetryviewer.gwt.client;

import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;

/**
 * Encapsulates the horizontal telemetry selection menu that found at all other widgets.
 *
 * @author Pavel Senin.
 *
 */
public class TelemetrySelectionWidget
    extends Composite {

  final ChartWidget parent;

  /* define the list first */
  private HorizontalPanel list = new HorizontalPanel();

  /**
   * Instantiates the series selection widget.
   *
   * @param parent the parent widget on which this will be displayed.
   */
  public TelemetrySelectionWidget(ChartWidget parent) {
    initWidget(list);
    setStyleName("telemetrySeries-list");
    Label rangeLabel = new Label("Series to show:");
    rangeLabel.setStyleName("telemetrySeries-label");
    list.add(rangeLabel);
    this.parent = parent;
  }

  /**
   * Adds the particular serie selector on the panel.
   *
   * @param box the series selector.
   */
  public void addSeries(CheckBox box) {
    box.setStyleName("telemetrySeries-item");
    list.add(box);
  }

}
